<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增商机')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-opportunity-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">名称：</label>
				<div class="col-sm-8">
					<input id="name" name="name" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">所属客户：</label>
				<div class="col-sm-8">
					<div class="input-group" style="width: 100%">
						<select name="customerId" class="form-control m-b" th:with="type=${@customer.list()}">
		                    <option th:each="dict : ${type}" th:text="${dict.name}" th:value="${dict.id}"></option>
		                </select>
		            </div>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">商机阶段：</label>
				<div class="col-sm-8">
					<div class="input-group" style="width: 100%">
	                    <select name="stage" class="form-control m-b" th:with="type=${@dict.getType('crm_opportunity_stage')}">
		                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
		                </select>
	                </div>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">预计金额：</label>
				<div class="col-sm-8">
					<input id="amountEstimate" name="amountEstimate" class="form-control" type="number">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">预计日期：</label>
				<div class="col-sm-8">
					<input id="dateEstimate" name="dateEstimate" class="time-input" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">补充说明：</label>
				<div class="col-sm-8">
					<textarea name="remark" autocomplete="off" maxlength="500" class="form-control" rows="3"></textarea>
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "crm/opportunity"
		$("#form-opportunity-add").validate({
			rules:{
				name:{
					required:true,
				},
			},
			focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-opportunity-add').serialize());
	        }
	    }
	</script>
</body>
</html>
